package com.maimao.kill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author MaoLin Wang
 * @date 2021/4/14 2:08 下午
 */
@Configuration
public class RedissonConfig {

    @Bean(name = "redissonClient",destroyMethod = "shutdown")
    public RedissonClient redissonClient() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://127.0.0.1:6379");
        config.useSingleServer().setConnectionPoolSize(1000);
        config.useSingleServer().setConnectionMinimumIdleSize(100);
        config.useSingleServer().setPassword("xiaoyunshi") ;
        return Redisson.create(config);
    }
}
